package com.ikun.mapper;

import com.ikun.pojo.DeliveryAddress;
import com.ikun.pojo.User;
import org.apache.ibatis.annotations.Mapper;

import java.util.List;

@Mapper
public interface UserMapper {
    //根据username与password查找用户
    public User getUserByUsernameAndPassword(String username, String password);

    //添加用户
    public int addUser(String username, String password);

    //根据userId查询其收货地址
    public List<DeliveryAddress> getAddressesByUserId(Integer userId);

    //添加收货地址
    public int addAddress(Integer userId, String deliveryAddress,
                          String phoneNumber, String contactName,
                          Integer sex, String tag, String doorPlate
    );
    //根据收货地址的id修改收货地址
    public int updateAddress(Integer addressId, String deliveryAddress,
                          String phoneNumber, String contactName,
                          Integer sex, String tag, String doorPlate
    );
    //根据收哦地址id删除收货地址
    public int deleteAddress(Integer addressId);
    public User getUserById(Integer id);

    public void updateNameByUserId(Integer userId,String name);
    public void updateBriefIntroductionByUserId(Integer userId,String briefIntroduction);

    void updateUserNameByUserId(Integer userId, String userName);

    public void updateAvatar(Integer userId, String resultUrl);
}
